<?php
if($_POST['xmlhttp']){
	include_once('config.php');
	include_once(mnminclude.'KMessaging.php');
	include_once(mnminclude.'link.php');
	include_once(mnminclude.'user.php');
	$linkid = $_POST['linkid'];
	$ownerid = $_POST['ownerid'];
	$thinglink = new Link();
	$thinglink->id = $linkid;
	$thinglink->read();
	$submitter = new User();
	$submitter->id = $thinglink->author;
	$submitter->read();
	$message =  new KMessaging();
	$message->tblName = table_messages;
	$title = '您对 ' . $thinglink->title . ' 的认领请求被拒绝';
	$body = '您对 <a href="story.php?id=' . $linkid . '" target="_blank">' . $thinglink->title . '</a> 的认领请求已被拒绝. 如有疑问，请与此物的首次推荐者<a href="user.php?uid=' . $submitter->id . '" target="_blank">' . $submitter->names . '</a>联系，或联系站务青铜(forestyaser@163.com)';
	$sender = 1;
	$receiver = $ownerid;
	$senderlevel = 0;
	$sendmsg = $message->SendMessege($title,$body,$sender,$receiver,$senderlevel);
	switch ($sendmsg) {
		case 0:
			echo "success";
			die();
			break;
		case 2:
			echo "nobody";
			die();
			break;
		case 1:
			echo "notitle";
			die();
			break;
		case 6:
			echo "database_error";
			die();
			break;
		default:
			echo "fail";
			die();
			break;
	}
}
?>